package com.lei.s04session.service.impl;

import java.util.List;

import com.lei.s04session.dao.LoginLogDao;
import com.lei.s04session.dao.impl.LoginLogDaoImpl;
import com.lei.s04session.entity.LoginLog;
import com.lei.s04session.service.LoginLogService;
import com.lei.sqlGoodsJsp.entity.LoginUserEntity;
import com.lei.sqlGoodsJsp.entity.Page;

public class LoginLogServiceImpl implements LoginLogService{
	private LoginLogDao loginLogDao = new LoginLogDaoImpl();
	@Override
	public void add(LoginLog record) {
		loginLogDao.add(record);
	}

	@Override
	public Page<LoginLog> page(int currentPageNo, int pageSize) {
		int count = loginLogDao.count();
		List<LoginLog> data = loginLogDao.list(currentPageNo, pageSize);
		int totalPage = count / pageSize;
		totalPage += count % pageSize == 0 ? 0 : 1;
		Page<LoginLog> page = new Page<>(count, totalPage, currentPageNo, data);
		return page;
	}

}
